package com.all.play.myslidingmenu;

import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;

public class MainActivity_beifen extends AppCompatActivity {

    private Toolbar toolbar;
    private DrawerLayout drawerLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_beifen);
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        //将actionBar替换成toolbar
        setSupportActionBar(toolbar);

        initView();


        initData();
    }

    private void initData() {

    }

    private void initView() {
        drawerLayout = (DrawerLayout) findViewById(R.id.drawlayout);
        //toolbar 添加返回键
        ActionBarDrawerToggle drawerToggle=
                new ActionBarDrawerToggle(this,drawerLayout,toolbar,
                        R.string.draw_open,R.string.draw_close);
        //drawerToggle与toolbar状态同步
        drawerToggle.syncState();
        //三道杠  侧滑按钮  设置监听
        //说明drawerToogle实现了DrawerListener
        //drawerToggle与toolbar,三道杠的旋转监听设置在这里才能同步
        drawerLayout.addDrawerListener(drawerToggle);

        //在右侧添加侧滑菜单,在此将布局文件做备份


    }
}
